package week2;

public class findmax {
    public static void main(String[] args) {
        int[] age = {18, 19, 21, 17, 16, 20, 16, 15};
        System.out.println("max=" + findMax(age, age.length));
    }

    public static int findMax(int[] age, int len) {
        int max = age[0];
        for (int i = 1; i < len; i++) {
            if (max < age[i]) {
                max = age[i];
            }
        }
        return max;
    }
}

